import fetch from 'common/src/utils/fetch';
import Cookies from 'js-cookie';

/**
 * 查询信息公告列表
 */
export function findCommonPublicMsgList(data) {
    return fetch({
        url: '/api/commonservice/commonPublicMsg/findCommonPublicMsgList',
        method: 'POST',
        data: data
    });
}

/**
 * 查询信息公告列表(首页使用)
 */
export function findHomePageCommonPublicMsg(data) {
    return fetch({
        url: '/api/commonservice/commonMsgPublish/findHomePageCommonMsgPublish',
        method: 'POST',
        data: data
    });
}


/**
 * 查看信息公告详情
 */
export function findCommonPublicMsgById(id) {
    return fetch({
        url: '/api/commonservice/commonPublicMsg/findCommonPublicMsgById?id=' + id,
        method: 'GET',
    });
}

/**
 * 新增信息公告
 */
export function addCommonPublicMsg(data) {
    return fetch({
        url: '/api/commonservice/commonPublicMsg/addCommonPublicMsg',
        method: 'post',
        data,
    });
}

/**
 * 修改信息公告
 */
export function updateCommonPublicMsg(data) {
    return fetch({
        url: '/api/commonservice/commonPublicMsg/updateCommonPublicMsg',
        method: 'put',
        data,
    });
}

/**
 * 删除信息公告
 */
export function deleteCommonPublicMsg(data) {
    return fetch({
        url: '/api/commonservice/commonPublicMsg/deleteCommonPublicMsg',
        method: 'delete',
        data,
    });
}

/**
 * 失效信息公告
 * data: ids: []
 */
export function updateTagStatus(data) {
    return fetch({
        url: '/api/commonservice/commonPublicMsg/updateTagStatus',
        method: 'put',
        data,
    });
}

/**
 * 提交信息公告审批
 */
export function checkCommonPublicMsg(data) {
    return fetch({
        url: '/api/commonservice/commonPublicMsg/checkCommonPublicMsg',
        method: 'post',
        data,
    });
}

/**
 * 审批结束后更新信息公告状态
 */
export function updateCommonPublicMsgStatus(data) {
    return fetch({
        url: '/api/commonservice/commonPublicMsg/updateCommonPublicMsgStatus',
        method: 'post',
        data,
    });
}

/**
 * 公告改版 接口
 */

// 查询信息公告列表
export function getPublicMsgList(data) {
    return fetch({
        url: '/api/commonservice/commonMsgPublish/findCommonMsgPublishList',
        method: 'POST',
        data: data
    });
}
// 查看信息公告详情
export function getPublicMsgDetail(id) {
    return fetch({
        url: '/api/commonservice/commonMsgPublish/findCommonMsgPublishById?id=' + id,
        method: 'GET',
    });
}

// 新增信息公告
export function addPublicMsg(data) {
    return fetch({
        url: '/api/commonservice/commonMsgPublish/addCommonMsgPublish',
        method: 'post',
        data
    });
}
// 更新信息公告
export function updatePublicMsg(data) {
    return fetch({
        url: '/api/commonservice/commonMsgPublish/updateCommonMsgPublish',
        method: 'put',
        data
    });
}
// 删除信息公告
export function deletePublicMsg(data) {
    return fetch({
        url: '/api/commonservice/commonMsgPublish/deleteCommonMsgPublish',
        method: 'delete',
        data
    });
}

// 失效信息公告
export function getPublicMsgStatus(data) {
    return fetch({
        url: '/api/commonservice/commonMsgPublish/updateTagStatus',
        method: 'put',
        data
    });
}

// 提交信息公告审批
export function submitPublicMsgApproval(data) {
    return fetch({
        url: '/api/commonservice/commonMsgPublish/checkCommonMsgPublish',
        method: 'post',
        data
    });
}

// 审批结束后更新信息公告状态
export function updateStatusAfterApproved(data) {
    return fetch({
        url: '/api/commonservice/commonMsgPublish/updateCommonMsgPublishStatus',
        method: 'post',
        data
    });
}
// 查询用户组列表 面向用户
export function getGroupUserList(data) {
    return fetch({
        url: '/api/userservice/userGroup/findUserGroupList',
        method: 'post',
        data
    });
}
// 首页弹屏
export function getBombscreenList(data) {
    return fetch({
        url: '/api/commonservice/commonMsgPublish/findPopCommonMsgPublish',
        method: 'post',
        data
    });
}

export function setBombscreenNotPrompt(data) {
    return fetch({
        url: '/api/commonservice/commonMsgPublish/addOrUpdateNoTipsMsg',
        method: 'post',
        data
    });
}
/**
 * 查询我的公告列表数据
 * @param {*} data 
 * 
 */
export function findMyCommonMsgPublish(data) {
    return fetch({
        url: '/api/commonservice/commonMsgPublish/findMyCommonMsgPublish',
        method: 'post',
        data
    });
}
/**
 * 查询公告置顶个数
 * @param {*} data 
 */
export function findTopCommonMsgPublish() {
    return fetch({
        url: '/api/commonservice/commonMsgPublish/findTopCommonMsgPublish',
        method: 'post'
    });
}
/**
 * 查询首页学术成果论文报告会通知列表
 * @param {*} data 
 * @returns 
 */
export function findReportList(data){
    return fetch({
        url:'api/compulsoryservice/thesisSymposiumApplyInfoT/homePageShow',
        method:'post',
        data
    })
}
/**
 * 查询首页高等讲堂列表
 * @param {*} data 
 * @returns 
 */
export function findHigherHallList(data){
    return fetch({
        url:'/sdata/rest/form/ext/queryLectureList',
        method:'post',
        data
    })
}


/**
 * 获取数睿系统cookie
 * @param {*} userId 
 * @returns 
 */
export function getSRToken(userId) {
  return fetch({
    url: "/api/compulsoryservice/compulsory/common/shurui/getToken?userId=" + userId,
    method: 'get'
  }).then(res=>{
      if(res.code==200){
          Cookies.set('token',res.data)
      }
      return res;
  })
}